package com.health.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.health.entity.PhysicalOrder;
import com.health.entity.RegisterOrder;
import com.health.entity.pojo.PageData;
import com.health.entity.pojo.dto.QueryPhysicalOrderDTO;
import com.health.entity.pojo.vo.RegisterOrderDownloadVO;
import com.health.mapper.PhysicalOrderMapper;
import com.health.service.IPhysicalOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 体检订单 服务实现类
 * </p>
 *
 * @author health
 * @since 2023-04-20
 */
@Service
public class PhysicalOrderServiceImpl extends ServiceImpl<PhysicalOrderMapper, PhysicalOrder> implements IPhysicalOrderService {

    @Override
    public PageData listPagePhysicalOrder(QueryPhysicalOrderDTO queryPhysicalOrderDTO) {
        IPage<PhysicalOrder> iPage = new Page<>(queryPhysicalOrderDTO.getCurrentPage(), queryPhysicalOrderDTO.getPageSize());
        IPage<PhysicalOrder> page = baseMapper.listPagePhysicalOrder(iPage, queryPhysicalOrderDTO);
        return new PageData(page.getTotal(), page.getRecords());
    }

    @Override
    public List<PhysicalOrder> listPageDownloadPhysicalOrder(QueryPhysicalOrderDTO queryPhysicalOrderDTO) {
        IPage<PhysicalOrder> iPage = new Page<>(queryPhysicalOrderDTO.getCurrentPage(), queryPhysicalOrderDTO.getPageSize());
        IPage<PhysicalOrder> page = baseMapper.listPagePhysicalOrder(iPage, queryPhysicalOrderDTO);
        return page.getRecords();
    }
}
